package com.lant.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lant.pojo.LantResult;
import com.lant.pojo.LantUser;
import com.lant.service.LantUserService;

@RestController
public class HelloController {

	@Autowired
	private LantUserService lantUserService;

	@GetMapping("/createUser")
	public LantResult createUser() {
		LantUser user = new LantUser();
		user.setUserName("流川枫");
		user.setMobile("18755667456");
		user.setEmail("18755667456@qq.com");
		user.setPassword("111111");

		//LantResult createUser = lantUserService.createUser(user);
		return null;
	}

	@GetMapping("/userLogin")
	public LantResult userLogin(String username, String password, HttpServletRequest request,
			HttpServletResponse response) {
		LantResult userLogin = lantUserService.login(username, password, request, response);
		return userLogin;
	}

	@GetMapping("/getUserByToken")
	public LantResult getUserByToken(String token) {
		LantResult getUserByToken = lantUserService.getUserByToken(token);
		return getUserByToken;
	}

	@GetMapping("/logoffUserByToken")
	public LantResult logoffUserByToken(String token) {
		LantResult logoffUserByToken = lantUserService.logoffUserByToken(token);
		return logoffUserByToken;
	}
}
